package com.softstao.guoyu.ui.activity.sale;

import android.content.Intent;
import android.text.TextUtils;
import android.widget.EditText;
import android.widget.TextView;

import com.softstao.guoyu.R;
import com.softstao.guoyu.base.BaseActivity;
import com.softstao.softstaolibrary.library.widget.LZToast;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by vaikus on 2017/6/20.
 */

public class OrderCancelActivity extends BaseActivity {
    @BindView(R.id.reason_title)
    TextView reasonTitle;
    @BindView(R.id.reason)
    EditText reason;
    @BindView(R.id.memo)
    TextView memo;
    private String type;

    @Override
    public int _ContentView() {
        return R.layout.activity_order_cancel;
    }

    @Override
    public void initView() {
        type = getIntent().getStringExtra("type");
        switch (type){
            case "cancel":
                initTitle("取消订单");
                memo.setText("注：系统将自动返还买家支付的虚拟币，买家可重新提交订单。");
                break;
            case "reject":
                initTitle("驳回收款");
                memo.setText("注：系统将自动返还买家支付的虚拟币，买家可重新付款。");
                break;
        }
    }

    @OnClick(R.id.submit_btn)
    public void onViewClicked() {
        if (TextUtils.isEmpty(reason.getText().toString())){
            LZToast.getInstance(context).showToast("内容不能为空");
            return;
        }
        Intent intent = getIntent();
        intent.putExtra("reason",reason.getText().toString());
        setResult(RESULT_OK,intent);
        finish();
    }
}
